﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; 
using Model.WeiXin;  
namespace Xproject.Util
{
    public class Cache_WeiXinConfig
    {

        public static string CACHE_KEY_WEIXIN_TOKEN = "CACHE_KEY_WEIXIN_TOKEN";
      

        public static string WeiXinToken {
            get {
                return System.Web.HttpRuntime.Cache[CACHE_KEY_WEIXIN_TOKEN] as  string;
            }
            set
            {
                System.Web.HttpRuntime.Cache.Insert(CACHE_KEY_WEIXIN_TOKEN, value, null, DateTime.Now.AddHours(2), System.Web.Caching.Cache.NoSlidingExpiration);
            }
        }

      

        public static  WeiXinConfig Get(string key)
        {
            return  System.Web.HttpRuntime.Cache[key] as WeiXinConfig;                          
        }

        public static  void Set(WeiXinConfig config,string key)
        {
            System.Web.HttpRuntime.Cache.Insert(key, config, null, DateTime.Now.AddMonths(1), System.Web.Caching.Cache.NoSlidingExpiration);
        }
    }
}
